import request from '@/utils/request.js'

// 分页获取归档列表
async function getArchievePages(currentPage, size) {
    try {
        let params = {
            currentPage,
            size
        }
        let res = await request.post('/archieve/pages', params)
        return res.data.data;
    } catch (error) {
        console.error(error);
        throw error;
    }
}

// 获取某个归档列表
async function getArchievesById(id) {
    try {
        let res = await request.get('/archieve/'+id)
        return res.data.data;
    } catch (error) {
        console.error(error);
        throw error;
    }
}

// 获取某个分类列表
async function geCategoriesById(id) {
    try {
        let res = await request.get('/category/'+id)
        return res.data.data;
    } catch (error) {
        console.error(error);
        throw error;
    }
}

// 获取某个标签列表
async function getTagsById(id) {
    try {
        let res = await request.get('/tag/'+id)
        return res.data.data;
    } catch (error) {
        console.error(error);
        throw error;
    }
}

export default {
  getArchievePages,
  getArchievesById,
  geCategoriesById,
  getTagsById,
};